#coding=utf-8
import pymysql
conn = pymysql.connect(
    host = '192.168.0.207',
    port = 3306,
    user = 'root',
    password = '123456',
    db = 'test'
)
cur = conn.cursor()
# 添加多条数据
# sqli = 'insert into user_info values(%s,%s)'
# cur.executemany(sqli,[('kuli',28),('tianya',78)])
# 添加单条用例
# cur.execute("create table book(bookid int,bname varchar(20),author varchar(20),sale float);")
cur.execute("insert into book values(202,'Python','guishu',33.9)")
#cur.execute("delete from book where bname='java';")
#获得数据
print(cur.fetchone())
cur.close()
conn.commit()
conn.close()